﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeFile="EditCar.aspx.cs" Inherits="Admin_EditCar" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
    <h1>
        Edit Car Details
    </h1><br />
    <div class="HolderDiv">
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4"
            DataKeyNames="car_id,plate_no" DataSourceID="SqlDataSource1" EnableModelValidation="True"
            ForeColor="Black" GridLines="Vertical" AllowPaging="True" 
            AllowSorting="True" BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" 
            BorderWidth="1px">
            <AlternatingRowStyle BackColor="White" />
            <Columns>
                <asp:CommandField ButtonType="Button" ShowEditButton="True" />
                <asp:BoundField DataField="car_id" HeaderText="Car ID" ReadOnly="True" SortExpression="car_id" />
                <asp:BoundField DataField="plate_no" HeaderText="Plate No" ReadOnly="True" SortExpression="plate_no" />
                <asp:BoundField DataField="brand" HeaderText="Brand" SortExpression="brand" />
                <asp:BoundField DataField="make" HeaderText="Make" SortExpression="make" />
                <asp:BoundField DataField="color" HeaderText="Color" SortExpression="color" />
                <asp:BoundField DataField="speed" HeaderText="Speed" SortExpression="speed" />
                <asp:BoundField DataField="tariff" HeaderText="Tariff" SortExpression="tariff" />
                <asp:BoundField DataField="availability" HeaderText="Availability" SortExpression="availability"
                    ReadOnly="true" />
                <asp:CommandField ButtonType="Button" ShowDeleteButton="True" />
            </Columns>
            <FooterStyle BackColor="#CCCC99" />
            <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
            <RowStyle BackColor="#F7F7DE" />
            <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
        </asp:GridView>
    </div>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:MySqlConnectionString %>"
        ProviderName="<%$ ConnectionStrings:MySqlConnectionString.ProviderName %>" SelectCommand="SELECT * FROM car"
        UpdateCommand="UPDATE car SET plate_no=@plate_no, brand=@brand, make=@make, color=@color, speed=@speed, tariff=@tariff WHERE car_id=@car_id AND plate_no=@plate_no LIMIT 1"
        DeleteCommand="DELETE FROM car WHERE car_id=@car_id AND plate_no=@plate_no LIMIT 1">
    </asp:SqlDataSource>
</asp:Content>
